package com.wst.system.server.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.wst.system.security.entity.enm.ApiTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;
import java.io.Serializable;
import lombok.Data;

/**
 * <p>
 * 
 * </p>
 *
 * @author X.I.O
 * @since 2025-01-16
 */

@Data
@ApiModel(description = "")
@TableName("sys_open_api")
public class SysOpenApi extends DataBase implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @ApiModelProperty(value = "主键")
    @TableId(type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "")
    private String apiName;

    @ApiModelProperty(value = "")
    private String apiUrl;

    private String apiType;

    private String apiNote;

    @TableField(exist = false)
    private String apiTypeName;

    public String getApiTypeName() {
        if(this.apiType!=null){
            for(ApiTypeEnum apiTypeEnum : ApiTypeEnum.values()) {
                if(apiTypeEnum.getType().equals(this.getApiType())) {
                    return apiTypeEnum.getTypeName();
                }
            }
        }
        return apiTypeName;
    }
}